using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


/// <summary>
/// The EmployeeContactTableManager class is responsible for managing BO.EmployeeContactTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class EmployeeContactTableManager
  {

#region "Public Methods"

/// <summary>
/// Gets a list with all EmployeeContactTable objects in the database.
/// </summary>
/// <returns>A list with all EmployeeContactTable from the database when the database contains any, or null otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, true)]
public static EmployeeContactTableList GetList(){
return EmployeeContactTableDB.GetList();
}

/// <summary>
/// Gets a single EmployeeContactTable from the database without its data.
/// </summary>
/// <param name="employeeContactKey">The EmployeeContactKey of the EmployeeContactTable in the database.</param>
/// <returns>A EmployeeContactTable object when the EmployeeContactKey exists in the database, or <see langword="null"/> otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EmployeeContactTable GetItem(int employeeContactKey){
return GetItem(employeeContactKey, false);
}

/// <summary>
/// Gets a single EmployeeContactTable from the database.
/// </summary>
/// <param name="employeeContactKey">The EmployeeContactKey of the EmployeeContactTable in the database.</param>
/// <param name="getEmployeeContactTableRecords">Determines whether to load all associated EmployeeContactTable records as well.</param>
/// <returns>
/// A EmployeeContactTable object when the EmployeeContactKey exists in the database, or <see langword="null"/> otherwise.
/// </returns>
[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EmployeeContactTable GetItem(int employeeContactKey, bool getEmployeeContactTableRecords){
EmployeeContactTable myEmployeeContactTable = EmployeeContactTableDB.GetItem(employeeContactKey);
return myEmployeeContactTable;
}

[DataObjectMethod(DataObjectMethodType.Select, false)]
public static EmployeeContactTable GetItemByUserAccountKey(int UserAccountKey)
{
    EmployeeContactTable myTeacherContactTable = EmployeeContactTableDB.GetItemByUserAccountKey(UserAccountKey);
    return myTeacherContactTable;
}


/// <summary>
/// Saves a EmployeeContactTable in the database.
/// </summary>
/// <param name="myEmployeeContactTable">The EmployeeContactTable instance to save.</param>
/// <returns>The new EmployeeContactKey if the EmployeeContactTable is new in the database or the existing EmployeeContactKey when an item was updated.</returns>
[DataObjectMethod(DataObjectMethodType.Update, true)]
public static int Save(EmployeeContactTable myEmployeeContactTable){
using (TransactionScope myTransactionScope = new TransactionScope()){
int employeeContactTableEmployeeContactKey = EmployeeContactTableDB.Save(myEmployeeContactTable);

//  Assign the EmployeeContactTable its new (or existing EmployeeContactKey).
myEmployeeContactTable.EmployeeContactKey = employeeContactTableEmployeeContactKey;

myTransactionScope.Complete();

return employeeContactTableEmployeeContactKey;
}
}

/// <summary>
/// Deletes a EmployeeContactTable from the database.
/// </summary>
/// <param name="myEmployeeContactTable">The EmployeeContactTable instance to delete.</param>
/// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(EmployeeContactTable myEmployeeContactTable){
return EmployeeContactTableDB.Delete(myEmployeeContactTable.EmployeeContactKey);
}

[DataObjectMethod(DataObjectMethodType.Delete, true)]
public static bool Delete(int EmployeeContactKey)
{
    return EmployeeContactTableDB.Delete(EmployeeContactKey);
}
#endregion

}

